﻿using System;
using System.Runtime.Serialization;
using System.Xml.Serialization;

namespace Dynamic.Data.Model.Query
{
    [DataContract]
    [XmlType(Namespace="DynamicMatrix")]
    public sealed class PagingInfo
    {
        private int _startRowNumber = 0;//开始计数
        private int _totalCount;//结果总数
        private int _pageSize = 10;//每页数量
        private int _pageIndex = 1;//当前页码
        private string _pagingCache;//缓存

        public void Accept(IQueryVisitor visitor)
        {
            visitor.Visit(this);
        }

        [DataMember]
        public int StartRowNumber
        {
            get
            {
                return this._startRowNumber;
            }
            set
            {
                this._startRowNumber = value;
            }
        }

        [DataMember]
        public int TotalCount
        {
            get
            {
                return this._totalCount;
            }
            set
            {
                this._totalCount = value;
            }
        }

        [DataMember]
        public int PageSize
        {
            get
            {
                return _pageSize;
            }
            set
            {
                this._pageSize = value;
            }
        }

        [DataMember]
        public int PageIndex
        {
            get
            {
                return this._pageIndex;
            }
            set
            {
                this._pageIndex = value;
            }
        }

        [DataMember]
        public string PagingCache
        {
            get
            {
                return this._pagingCache;
            }
            set
            {
                this._pagingCache = value;
            }
        }
    }
}

